#   Copyright (C) 2008      Tri Tech Information Systems Inc.
# 
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
# 
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
# 
#   You should have received a copy of the GNU General Public License along
#   with this program; if not, write to the Free Software Foundation, Inc.,
#   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#   
import sys

from pyxx.wrapper import ExposedWrapper
from pyxx.formatters import *
from pyxx.parser import CodeModel
from pyxx.method import PickMethodWrapper
from pyxx.element import MemberVariableWrapper
from pyxx.callable import BaseFunctionWrapper
from pyxx.function import find_function
from pyxx.error import WrapperError



class NamespaceWrapper( ExposedWrapper ):

    WRAPPER_TEMPLATE = '''
        bpy::object obj = bpy::import("pyxx_helper").attr("cpp_namespace")();
        this_scope.attr(%(quoted_python_name)s) = obj;

        bpy::object namespaces = import("pyxx_helper").attr("__namespaces__");
        namespaces["%(ns_name)s"] = obj;
                
    '''                

    
    def __init__( self, ctx, ns_name, ns, module, **kw):
        ExposedWrapper.__init__( self, ctx, ns, **kw)
        self.module = module
        self.ns_name = ns_name

